from urllib import request
import json

url = "http://httpbin.org/get"
res = request.urlopen(url)
content_bytes = res.read()
content = content_bytes.decode()
print(content)
data = json.loads(content)
print(data["headers"]["User-Agent"])